package com.aiwhose.aiwhosefile.service;

import com.aiwhose.aiwhosecore.bean.Result;
import com.aiwhose.aiwhosefile.bean.FileQiniuSecurity;
import com.mybatisflex.core.service.IService;
import com.aiwhose.aiwhosecore.bean.file.File;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Map;

/**
 * 文件 服务层。
 *
 * @author 田国刚
 * @since 1.0.1
 */
public interface FileService extends IService<File> {
    ArrayList<File> uploadFile(MultipartFile[] files , String user , String bucket ) throws Exception;
    Result reUploadFile(MultipartFile[] files, String user, String path, String bucket  ) throws IOException;
    Result downloadFile( String path, Long time,String bucket ) throws UnsupportedEncodingException;
    String getPrivateUrl(String path) throws UnsupportedEncodingException;
    Result deleteFile(  String[] path , String bucket );

    Result getFileList( Integer maxLimit, String prefix, String delimiter, String bucket );
    Result getFileListData( File file,String user );
    String getToken(FileQiniuSecurity fileQiniuSecurity , String path );
    String getUserToken(String userId,String type);
    String getQiniuAuthorization(String bucket,  String url, String method, byte[] body );
}
